package cn.b.sky.mes.qm.model;

import java.io.Serializable;
import java.util.List;

import org.apache.commons.lang3.StringUtils;

import cn.b.sky.common.model.ImeCommon;
import cn.b.sky.common.model.TreeInterface;

public class DefectNode extends ImeCommon implements TreeInterface, Serializable {

  /**
   * @Fields serialVersionUID : 序列化
   * @creator :lidapeng
   */
  private static final long serialVersionUID = 1L;

  private String nodeCode;

  private String nodeText;

  private String parentNodeCode;

  private String nodeTypeeCode;

  private String defectCode;

  /**
   * 页面展示
   */
  private String defectText;

  private Integer lockFlag = 0;

  private List<DefectNode> childrens;

  /**
   * 背景色
   */
  private String backgroundColor;

  /**
   * 缺陷锁定标记
   */
  private Integer defectLockFlag;

  public Integer getDefectLockFlag() {
    return defectLockFlag;
  }

  public void setDefectLockFlag(Integer defectLockFlag) {
    this.defectLockFlag = defectLockFlag;
  }

  public String getBackgroundColor() {
    return backgroundColor;
  }

  public void setBackgroundColor(String backgroundColor) {
    this.backgroundColor = backgroundColor;
  }

  public String getNodeCode() {
    return nodeCode;
  }

  /**
   * 参数注入时大写
   */
  public void setNodeCode(String nodeCode) {
    this.nodeCode = StringUtils.upperCase(nodeCode);
  }

  public String getNodeText() {
    return nodeText;
  }

  public void setNodeText(String nodeText) {
    this.nodeText = nodeText;
  }

  public String getParentNodeCode() {
    return parentNodeCode;
  }

  public void setParentNodeCode(String parentNodeCode) {
    this.parentNodeCode = parentNodeCode;
  }

  public String getNodeTypeeCode() {
    return nodeTypeeCode;
  }

  public void setNodeTypeeCode(String nodeTypeeCode) {
    this.nodeTypeeCode = nodeTypeeCode;
  }

  public String getDefectCode() {
    return defectCode;
  }

  public void setDefectCode(String defectCode) {
    this.defectCode = defectCode;
  }

  public String getDefectText() {
    return defectText;
  }

  public void setDefectText(String defectText) {
    this.defectText = defectText;
  }

  public Integer getLockFlag() {
    return lockFlag;
  }

  public void setLockFlag(Integer lockFlag) {
    this.lockFlag = lockFlag;
  }

  public List<DefectNode> getChildrens() {
    return childrens;
  }

  public void setChildrens(List<DefectNode> childrens) {
    this.childrens = childrens;
  }

  @Override
  public void setTrees(List trees) {
    this.childrens = trees;

  }

  @Override
  public String getPid() {

    return this.parentNodeCode;
  }

  @Override
  public String getNodeId() {
    return this.nodeCode;
  }

  /**
   * 是否为叶子节点判断
   */
  public Boolean getIsLeaf() {
    if (this.childrens != null && this.childrens.size() > 0) {
      return false;
    }

    return true;
  }
}
